package com.emergency.situation.controller;

import com.emergency.base.domain.Scenar;
import com.emergency.common.entity.Result;
import com.emergency.common.entity.StatusCode;
import com.emergency.situation.service.RealTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/real")
@Api(value="态势数据更新类",description = "心跳检测，或者做定时器，实时的更新数据到前端系统中")
public class RealTimeController {

    @Autowired
    private RealTimeService realTimeService;

    @ApiOperation(value = "态势实时数据获取接口" ,  notes="可以做一个缓存，当缓存数据变化时，再调用接口获取数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scenar", value = "想定文件", required = true, paramType = "body", dataType = "Scenar")
    })
    @RequestMapping(value = "update/data",method = RequestMethod.GET)
    public Result data(String scenarId){
        String data=realTimeService.getStateData(scenarId);
        return new Result(true, StatusCode.OK,  "操作成功", "");
    }
}
